﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Windows;

namespace Puzzler.Plugin.Interface
{
    public abstract class GridCellInfo : DependencyObject, INotifyPropertyChanged, ICloneable
    {
        public event PropertyChangedEventHandler PropertyChanged;

        /// <summary>
        /// Copy the data from the source object and fill these into the current object property fields
        /// </summary>
        /// <param name="cellInfo">Source object</param>
        public abstract void CopyFrom(GridCellInfo cellInfo);

        protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e)
        {
            base.OnPropertyChanged(e);
            OnPropertyChanged(e.Property.Name);
        }

        protected void OnPropertyChanged(String propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        public abstract object Clone();
    }
}
